﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var status = '@ViewBag.status';
    var number = '@ViewBag.number';
    $(function () {
        initControl();
        gridList();
    });
    function initControl() {
        var myLayout = $('#layout').layout({ resizable: false });
        if (status == 'U') {
            if ($('#oldEntity').val() != '') {
                var data = JSON.parse($('#oldEntity').val());
                setDataByJson("#form1", data);
            }
        }
        initBindSelect("#form1");


        //$('select').bindSelect();
        //$('#recommend-element').on('change', function () {
        //    var flag = $('#recommend-element').val();
        //    //alert(flag);
        //    if (flag == 'recommend1') {
        //        showList1();
        //    } else if (flag == 'recommend2') {
        //        showList2();
        //    } else if (flag == 'recommend3') {
        //        showList3();
        //    }
        //})
    }
    function gridList1() {
        var $gridList1 = $("#gridList1");
        $gridList1.dataGrid({
            //url: "/SystemManage/User/GetGridJson",
            height: $(window).height() - 280,
            colModel: [
                { label: '容器编号', name: '', width: 80, align: 'center' },
                { label: '容器名称', name: '', width: 80, align: 'center' }
            ],
            sortname: 'F_DepartmentId asc,F_CreatorTime desc',
            viewrecords: true,  //是否显示行数
            rownumWidth: 40,
        });
        $gridList1.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
    }
    function reloadGrid1() {
        $("#gridList1").jqGrid('setGridParam', {
            url: "",
        }).trigger('reloadGrid');
    }
    function gridList2() {
        var $gridList2 = $("#gridList2");
        $gridList2.dataGrid({
            //url: "/SystemManage/User/GetGridJson",
            height: $(window).height() - 280,
            colModel: [
                { label: '零件编号', name: '', width: 80, align: 'center' },
                { label: '零件名称', name: '', width: 80, align: 'center' },
                { label: '制造单位', name: '', width: 80, align: 'center' },
                { label: '制造单位名称', name: '', width: 120, align: 'center' },
                { label: '零件状态', name: '', width: 80, align: 'center' }
            ],
            sortname: 'F_DepartmentId asc,F_CreatorTime desc',
            viewrecords: true,  //是否显示行数
            rownumWidth: 40,
        });
        $gridList2.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
    }
    function reloadGrid2() {
        $("#gridList2").jqGrid('setGridParam', {
            url: "",
        }).trigger('reloadGrid');
    }
    function gridList3() {
        var $gridList3 = $("#gridList3");
        $gridList3.dataGrid({
            //url: "/SystemManage/User/GetGridJson",
            height: $(window).height() - 280,
            colModel: [
                { label: '制造单位', name: '', width: 80, align: 'center' },
                { label: '制造单位名称', name: '', width: 120, align: 'center' }
            ],
            sortname: 'F_DepartmentId asc,F_CreatorTime desc',
            viewrecords: true,  //是否显示行数
            rownumWidth: 40,
        });
        $gridList3.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
    }
    function reloadGrid3() {
        $("#gridList3").jqGrid('setGridParam', {
            url: "",
        }).trigger('reloadGrid');
    }

    function showList1() {
        $("#grid111").show();
        $("#grid222").hide();
        $("#grid333").hide();
        reloadGrid1();
    }
    function showList2() {
        $("#grid111").hide();
        $("#grid222").show();
        $("#grid333").hide();
        reloadGrid2();
    }
    function showList3() {
        $("#grid111").hide();
        $("#grid222").hide();
        $("#grid333").show();
        reloadGrid3();
    }
    function btn_add() {
        var flag = $('#recommend-element').val();
        var title = '';
        var url = '';
        if (flag == 'recommend1') {
            title = '选择容器';
            url = '/MainData/Storage/RecommendContainer';
        } else if (flag == 'recommend2') {
            title = '选择产品';
            url = '/MainData/Storage/RecommendStamping';
        } else if (flag == 'recommend3') {
            title = '选择供应商';
            url = '/MainData/Storage/RecommendSupplier';
        }
        $.detailOpen2({
            id: "Detail",
            title: title,
            url: url
        });
    }
    function btn_ok() {
        parent.$.detailClose();
    }
    function btn_cancel() {
        parent.$.detailClose();
    }
</script>
<div class="ui-layout" id="layout" style="height: 96%; width: 100%;">
    <input id="oldEntity" type="hidden" value="@ViewBag.oldEntity" />
    <form id="form1">
        <div style="width:950px;margin:0 auto;">
            <table class="form" style="width:900px;text-align:right;margin:15px;border-bottom:2px solid #ccc;">
                <tr>
                    <td class="formValue input-width-185" style="width:500px;padding-left:100px;text-align:left;">
                        &nbsp;
                    </td>
                    <td style="width: 300px; padding: 5px 10px;">
                        <div class="btn-group" style="margin-right:20px;">
                            <a id="btn_ok" class="btn btn-primary center-block" onclick="btn_ok()"><span class="glyphicon glyphicon-ok"></span> 确认</a>
                        </div>
                        <div class="btn-group">
                            <a id="btn_cancel" class="btn btn-primary center-block" onclick="btn_cancel()"><span class="glyphicon glyphicon-remove"></span> 取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;">
                <tr>
                    <th class="formTitle">货位类型</th>
                    <td class="formValue input-width-320">
                        <select id="FStoType" name="FStoType" class="form-control">
                            <option value="1">1-区号-按平面存放</option>
                            <option value="2">2-架号-按货架存放</option>
                            <option value="3">3-层号-按分层存放</option>
                            <option value="4">4-单元-按货架单元</option>
                            <option value="5">5-单元-按存储单元</option>
                        </select>
                    </td>
                    <th class="formTitle">货架编号</th>
                    <td class="formValue input-width-105">
                        <input id="" type="text" class="form-control" value="" />
                        <label class="prefix">层数</label><input id="FRows1" name="FRows" type="text" class="form-control input-width-40 text-right digits" value="" />
                        <label class="prefix">列数</label><input id="FCols1" name="FCols" type="text" class="form-control input-width-40 text-right digits" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">单位仓库</th>
                    <td class="formValue input-width-320">
                        <select id="FStoreNO" name="FStoreNO" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.storeHouseList)
                            {
                                <option value="@item.FStoreNO">@item.FStoreNO @item.FStoreName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle">货架层号</th>
                    <td class="formValue input-width-320">
                        <input id="FRows2" name="FRows" type="text" class="form-control text-right digits" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">区位编号</th>
                    <td class="formValue input-width-105">
                        <input id="regionNumber" name="" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">货架列号</th>
                    <td class="formValue input-width-320">
                        <input id="FCols2" name="FCols" type="text" class="form-control text-right digits" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">优先级别</th>
                    <td class="formValue input-width-320">
                        <select id="FLevel" name="FLevel" class="form-control">
                            <option>1-一级-主要存储区</option>
                            <option>2-二级-中转存储区</option>
                            <option>3-三级-临时存储区</option>
                        </select>
                    </td>
                    <th class="formTitle">使用标志</th>
                    <td class="formValue input-width-320">
                        <select id="FEnableSign" name="FEnableSign" class="form-control">
                            <option>0-封存</option>
                            <option>1-在用</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">推荐方式</th>
                    <td class="formValue input-width-240">
                        <select id="FStorageSign" name="FStorageSign" class="form-control">
                            <option value="1">1-按零件推荐</option>
                            <option value="2">2-按容器推荐</option>
                            <option value="3">3-按供应商推荐</option>
                        </select>
                        <div class="btn-group" style="margin-left:5px;">
                            <a id="" class="btn btn-primary center-block btn-1" onclick="btn_add()"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                        </div>
                    </td>
                    <th class="formTitle">货位说明</th>
                    <td class="formValue input-width-320">
                        <input id="FStoreDesc" name="FStoreDesc" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div style="padding: 5px 0 5px 20px;">
                            <div id="grid111" style="width:100%">
                                <table id="gridList1"></table>
                            </div>
                            <div id="grid222" style="width: 100%">
                                <table id="gridList2"></table>
                            </div>
                            <div id="grid333" style="width: 100%">
                                <table id="gridList3"></table>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

